package it.traveldream.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name="CustomerInvites")
@NamedQueries({
	@NamedQuery(
			name = "getInvitesByLink",
			query = "SELECT i FROM CustomerInvites i WHERE "
					+ "i.link = :link"
			)
})
public class CustomerInvites {

	@Column(nullable = false)
	private String friendAddress;
	@Column(nullable = false)
	private String link;
	
	@Id
	@ManyToOne(optional = false)
	@JoinColumn(name = "RESERVATIONID", referencedColumnName = "RESERVATIONID", nullable = false)
	private Reservation reservation;
	
	@ManyToOne(optional = false)
	@JoinColumn(name = "CUSTOMER", referencedColumnName = "USERNAME", nullable = false)
	private Customer customer;
	
	public CustomerInvites(){
		super();
	}

	public String getFriendAddress() {
		return this.friendAddress;
	}

	public void setFriendAddress(String friendAddress) {
		this.friendAddress = friendAddress;
	}

	public Customer getCustomer() {
		return this.customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public Reservation getReservation() {
		return this.reservation;
	}

	public void setReservation(Reservation reservation) {
		this.reservation = reservation;
	}

	public String getLink() {
		return this.link;
	}

	public void setLink(String link) {
		this.link = link;
	}
}
